package com.fujica.invoicing.service.impl;

import com.fujica.invoicing.entity.TStore;
import com.fujica.invoicing.mapper.IStoreMapper;
import com.fujica.invoicing.service.IStoreService;
import com.fujica.invoicing.utils.Result;
import com.fujica.invoicing.utils.ResultBody;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName StoreServiceImpl
 * @Description TODO
 * @Author admin
 * @Date 2020/8/11 14:13
 * @Version 1.0
 **/
@Service
public class StoreServiceImpl implements IStoreService {

    @Autowired
    private IStoreMapper iStoreMapper;

    /**
     * 获取商店列表
     * @return
     */
    @Override
    public Result list() {

        // 查询所有的商店
        List<TStore> storeList = iStoreMapper.selectAll();
        // 判断是否为空 不为空则返回数据
        if (!storeList.isEmpty()) {
            return ResultBody.ok(storeList);
        }
        return ResultBody.ok();
    }
}
